<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
  String admin = (String) session.getAttribute("admin");
  if (admin == null || !admin.equals("true")) {
    response.sendRedirect("/admin/404.jsp");
  }
%>
<html>
<head>
  <script src="../js/jquery/3.2.1/jquery.js"></script>
  <link href="../css/bootstrap/3.3.7/bootstrap.min.css" rel="stylesheet">
  <script src="../js/bootstrap/bootstrap.js"></script>
  <link href="../css/back/style.css" rel="stylesheet">
  <script>
    function checkEmpty(id, name) {
      var value = $("#" + id).val();
      if (value.length == 0) {
        alert(name + "不能为空");
        $("#" + id)[0].focus();
        return false;
      }
      return true;
    }

    function checkNumber(id, name) {
      var value = $("#" + id).val();
      if (value.length == 0) {
        alert(name + "不能为空");
        $("#" + id)[0].focus();
        return false;
      }
      if (isNaN(value)) {
        alert(name + "必须是数字");
        $("#" + id)[0].focus();
        return false;
      }
      if (value < 0) {
        alert(name + "必须大于等于0");
        $("#" + id)[0].focus();
        return false;
      }

      return true;
    }

    function checkInt(id, name) {
      var value = $("#" + id).val();
      if (value.length == 0) {
        alert(name + "不能为空");
        $("#" + id)[0].focus();
        return false;
      }
      if (parseInt(value) != value) {
        alert(name + "必须是整数");
        $("#" + id)[0].focus();
        return false;
      }
      if (value < 0) {
        alert(name + "必须大于等于0")
        $("#" + id)[0].focus();
        return false;
      }
      return true;
    }

    $(function () {
      $("a").click(function () {
        var deleteLink = $(this).attr("deleteLink");
        //console.log(deleteLink);
        if (deleteLink == "true") {
          var confirmDelete = confirm("确认删除?");
          if (confirmDelete)
            return true;
          return false;
        }
      });
    })
  </script>
</head>
<body>